fix request size limit for multi delete#5868
Conversation
Hello sylvainsenechal,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
Incorrect fix versionThe
Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:
Please check the |
f7881d5 to
eb64cfc
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
@@ Coverage Diff @@
## development/9.1 #5868 +/- ##
================================================
Coverage 75.91% 75.91%
================================================
Files 188 188
Lines 11976 11979 +3
================================================
+ Hits 9091 9094 +3
Misses 2885 2885
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
|
eb64cfc to
9c4d893
Compare
| const defaultMaxPostLength = request.method === 'POST' ? | ||
| 1024 * 1024 : 512 * 1024; // 1 MB or 512 KB |
There was a problem hiding this comment.
as an optim I think these values should be computed outside of the function, as it would be evaluated in every request otherwise, let's compute it on top of the file?
There was a problem hiding this comment.
it depends on request.method, so can't really be computed earlier... And apisLengthLimits is really a constant, so not sure it will change much...
There was a problem hiding this comment.
I mean the 1024*1024 and 512*1024, this can be the real value directly.
There was a problem hiding this comment.
I can set it in the constants.js file
| if (err || objects.length < 1 || objects.length > 1000) { | ||
| return next(errors.MalformedXML); | ||
| if (err || objects.length < 1 || objects.length > constants.maximumBatchDeleteObjects) { | ||
| return next(errors.MalformedXML.customizeDescription( |
There was a problem hiding this comment.
To use customizeDescription we must not use errors but errorInstances. I think the error should stay the same, unless we are able to confirm what AWS exactly sends, we should be 100% consistent, so we can just keep the base error IMHO
There was a problem hiding this comment.
I thought it would be nice to have a more descriptive errors but yeah if we want to stick the same aws errors I'll remove it
| const MAX_POST_LENGTH = request.method === 'POST' ? | ||
| 1024 * 1024 : 1024 * 1024 / 2; // 1 MB or 512 KB | ||
| const apisLengthLimits = { | ||
| // Multi Objects Delete request can be large : up to 1000 keys of 1024 bytes is |
There was a problem hiding this comment.
Were you able to confirm we reach the limit with the 1000 keys?
There was a problem hiding this comment.
probably depends on the key length : which can be up to 1024 bytes per key, according to AWS...
There was a problem hiding this comment.
Yeah I called the api with smaller requests, and change manually the max_post_length to a significantly lower value to trigger my errors. I logged the body length too and yeah with 1000 long keys it's gonna go above 1MB
| return next(errors.MalformedXML); | ||
| if (err || objects.length < 1 || objects.length > constants.maximumBatchDeleteObjects) { | ||
| return next(errors.MalformedXML.customizeDescription( | ||
| `The provided request tries to delete ${objects.length} objects, ` + |
There was a problem hiding this comment.
is this the message that AWS returns? (the AWS standard part looks weird)
as a general rule of thumb, we want to stick to same behavior (esp errors) as AWS
There was a problem hiding this comment.
No it's my own error, I realized we want to have the exact same errors as aws so I'll remove it
9c4d893 to
634e1ba
Compare
634e1ba to
c0b1d0c
Compare
|
/approve |
In the queueThe changeset has received all authorizations and has been added to the The changeset will be merged in:
The following branches will NOT be impacted:
There is no action required on your side. You will be notified here once IMPORTANT Please do not attempt to modify this pull request.
If you need this pull request to be removed from the queue, please contact a The following options are set: approve |
|
I have successfully merged the changeset of this pull request
The following branches have NOT changed:
Please check the status of the associated issue CLDSRV-699. Goodbye sylvainsenechal. |
Issue: CLDSRV-699